home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Graphics / EPS Fixer 1.3 / Scripting / Droppable EPS Fixer (text) next >
Encoding:
Text File  |  1994-11-23  |  1.1 KB  |  40 lines  |  [TEXT/ToyS]

  1. on open fileDropList
  2.     set theCount to count of fileDropList
  3.     set filesProcessed to 0
  4.     repeat with i from 1 to theCount
  5.         set theFile to item i of fileDropList as alias
  6.         set theInfo to info for theFile
  7.         set theType to file type of theInfo
  8.         if theType = "TEXT" or theType = "EPSF" then
  9.             ProcessFiles(theFile)
  10.             set filesProcessed to filesProcessed + 1
  11.         end if
  12.     end repeat
  13.     tell application "EPS Fixer" to quit
  14.     if filesProcessed > 0 then
  15.         if filesProcessed is equal to 1 then
  16.             set resultString to "One file was processed."
  17.         else
  18.             set resultString to {theCount, " files were processed."} as string
  19.         end if
  20.     else
  21.         set resultString to {"No files were processed."} as string
  22.     end if
  23.     display dialog resultString buttons "OK" with icon 1 default button 1
  24. end open
  25.  
  26. on ProcessFiles(theFile)
  27.     set theName to name of (the info for theFile)
  28.     tell application "EPS Fixer"
  29.         open theFile
  30.         save document theName in theFile
  31.         close window theName
  32.     end tell
  33. end ProcessFiles
  34.  
  35. on run
  36.     set theFile to (choose file of type {"TEXT", "EPSF"}) as alias
  37.     ProcessFiles(theFile)
  38.     tell application "EPS Fixer" to quit
  39. end run
  40.